package org.example.springcloud.util;

import com.github.pagehelper.Page;
import org.example.springcloud.bean.PageResult;

import java.util.List;

public class PageResultUtil {

    /**
     * 分页工具
     * @param list
     * @return
     * @param <T>
     */
    public static <T> PageResult<T> getPageResult(List<T> list) {
        Page<T> listPage = (Page<T>) list;
        return new PageResult<T>(listPage.getTotal(), listPage.getResult());
    }
}
